//数据库操作的封装与复用

const mysql = require("mysql");
//连接池
let pool = mysql.createPool({
    post: "192.168.174.166",
    user: "root",
    password: "ddd",
    database: "informationsys"
})

module.exports = {
    query: (sql, args) => {
        let p1 = new Promise((resolve, reject) => {
            pool.query(sql, [...args], (err, results, fields) => {
                if (err) {
                    reject(err);
                }
                else {
                    resolve(results);
                }
            })
        })
        return p1;
    }
}